/* 
 * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
 * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

#ifndef _MB_CONFIG_H
#define _MB_CONFIG_H

#ifdef __cplusplus
PR_BEGIN_EXTERN_C
#endif
/* ----------------------- Defines ------------------------------------------*/
/*! \defgroup modbus_cfg Modbus配置
 *
 * 协议栈中的大多数模块都是完全可选的，可以被排除。如果目标资源非常有限且需要节省程序存储空间，这一点就尤为重要。
 * 所有这些设置都可在mbconfig.h文件中找到。
 */
/*! \addtogroup modbus_cfg
 *  @{
 */
/*! \brief 如果启用了Modbus ASCII支持 */
#define MB_ASCII_ENABLED                        (  0 )

/*! \brief 如果启用了Modbus RTU支持*/
#define MB_RTU_ENABLED                          (  1 )

/*! \brief 如果启用了Modbus TCP支持 */
#define MB_TCP_ENABLED                          (  0 )

/*! \brief Modbus ASCII的字符超时值
 *
 * Modbus ASCII的字符超时值不是固定的，因此它是一个配置选项。该值应设置为网络的最大预期延迟时间。
 */
#define MB_ASCII_TIMEOUT_SEC                    (  1 )


/*! \brief 协议栈应支持的Modbus功能码的最大数量
 *
 * 支持的Modbus功能的最大数量必须大于此文件中所有已启用功能与自定义功能处理程序的总和。如果设置得过小，添加更多功能将会失败。
 */
#define MB_FUNC_HANDLERS_MAX                    ( 16 )

/*! \brief 应为报告从站ID分配的字节数命令
 *
 * 此数字限制报告从站ID功能中附加段的最大大小。有关如何设置此值的更多信息，请参见WHT_MB_Set_Slave_ID()。仅当MB_FUNC_OTHER_REP_SLAVEID_ENABLED设置为1时，才会使用此数字。
 */
#define MB_FUNC_OTHER_REP_SLAVEID_BUF           ( 32 )

/*! \brief 是否应启用 报告从机ID 功能 */
#define MB_FUNC_OTHER_REP_SLAVEID_ENABLED       (  1 )

/*! \brief 是否应当启用 读取输入寄存器 功能 */
#define MB_FUNC_READ_INPUT_ENABLED              (  1 )

/*! \brief 是否应该启用 读取保持寄存器 功能 */
#define MB_FUNC_READ_HOLDING_ENABLED            (  1 )

/*! \brief 是否应启用 写入单个寄存器 功能 */
#define MB_FUNC_WRITE_HOLDING_ENABLED           (  1 )

/*! \brief 是否应启用写入多个寄存器 功能 */
#define MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED  (  1 )

/*! \brief 是否应启用 读取线圈 功能 */
#define MB_FUNC_READ_COILS_ENABLED              (  1 )

/*! \brief 是否应启用 写线圈 功能 */
#define MB_FUNC_WRITE_COIL_ENABLED              (  1 )

/*! \brief 是否应启用 写入多个线圈 功能 */
#define MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED    (  1 )

/*! \brief 是否应启用 读取离散输入 功能 */
#define MB_FUNC_READ_DISCRETE_INPUTS_ENABLED    (  1 )

/*! \brief 是否应启用 读取/写入多个寄存器 功能 */
#define MB_FUNC_READWRITE_HOLDING_ENABLED       (  1 )

/*! @} */
#ifdef __cplusplus
    PR_END_EXTERN_C
#endif
#endif
